<template>
  <!-- 电子签约平台全业务授权书 -->
  <view>
    <uni-popup ref="showLegalBook">
      <view class="content_list">
        <!-- <view class="tip">
          <i class="iconfont colorIcon" style="margin-right: 10rpx;font-size: 26rpx;">&#xe70f;</i>
          电子签约平台全业务授权书（法定代表人证件号码不方便填写的，可暂不填写，由法定代表人签署授权书时，自主填写。）
        </view> -->
        <!-- 数据列表 -->
        <scroll-view scroll-y="true" class="scroll_view_style">
          <div style="margin: 15rpx;" v-html="legalBookContent"></div>
        </scroll-view>
      </view>
    </uni-popup>
  </view>
</template>

<script>
import {legalCertBook} from "@/api/ec/work/company/companyCertification";
import {formatTemplateField} from "@/utils";

export default {
  data() {
    return {
      // 表单内容
      ruleForm: {},
      // 电子签约平台全业务授权书 内容
      legalBookContent: null,
    }
  },
  created() {
  },
  methods: {
    /** 打开弹出框 */
    toOpenDialog(ruleForm) {
      this.ruleForm = ruleForm;
      this.getContent();
    },
    /** 取消按钮 */
    cancel() {
      this.$refs.showLegalBook.close()
    },
    /** 获取授权书内容 */
    getContent(){
      uni.showLoading({title: '加载中...', mask: true});
      legalCertBook().then((response) => {
        uni.hideLoading();
        const record = {
          staffName: this.$store.getters.staffInfo.name,
          staffIdNumer: this.$store.getters.staffInfo.idNumber,
          legalName: this.ruleForm.legalPerson || "--",
          companyNames: this.ruleForm.companyName,
          regNum: this.ruleForm.regNum || "--",
          legalIdNumber: this.ruleForm.legalPersonIdNumber || "--"
        };
        this.legalBookContent = formatTemplateField(response.data.content, record);
        this.$refs.showLegalBook.open('bottom')
      }).catch(() => {
        uni.hideLoading();
      });
    },
  }
}
</script>

<style lang="scss" scoped>

.content_list {
  height: 1000rpx;
  overflow-x: hidden;
  background: #FFFFFF;
  padding: 0 0 10rpx 0;

  .scroll_view_style {
    height: 100%;
  }
}

.tip {
  background: #E6F6EF;
  padding: 15rpx;
  font-size: 22rpx;
  font-weight: 400;
  color: #555b65;
  line-height: 35rpx;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: baseline;
  -ms-flex-align: baseline;
  align-items: baseline;
  margin-bottom: 10rpx;
}
</style>
